<?php defined('_JEXEC') or die('Restricted access'); ?>

<?php  JHTML::_('behavior.tooltip');  ?>

<?php  
	JToolBarHelper::title( 'Zarządzanie maszynami', 'maszyna.png' );
	JToolBarHelper::pdf();
	
	
?>

<form action="index.php?option=com_maszyny_user" method="post" name="adminForm">
	<table>
		<tr>
			<td width="100%" rowspan="2">
				<input type="text" name="search" id="search" value="<?php echo htmlspecialchars($this->lists['search']);?>" class="text_area" onchange="document.adminForm.submit();" />
				<button onclick="this.form.submit();"><?php echo 'Szukaj'; ?></button>
				<button onclick="document.getElementById('search').value='';this.form.getElementById('filter_type').value='0';this.form.getElementById('filter_logged').value='0';this.form.submit();"><?php echo JText::_( 'Reset' ); ?></button>
			</td>
			<td nowrap="nowrap">
				<?php echo $this->lists['typ'];?>
			</td>
			<td nowrap="nowrap">
				<?php echo $this->lists['mo1'];?>
			</td>
			<td nowrap="nowrap">
				<?php echo $this->lists['mo2'];?>
			</td>
			<td nowrap="nowrap">
				<?php echo $this->lists['mo3'];?>
		  	</td>
		  	<td nowrap="nowrap">
		  		<?php echo $this->lists['dotacja'];?>
		  	</td>
		  	<td nowrap="nowrap">
		  		<?php echo $this->lists['msw1'];?>
		  	</td>
		  </tr>
		  <tr>
		  	<td nowrap="nowrap">
		  		<?php echo $this->lists['msw6'];?>
		  	</td>
		  	<td colspan="2" nowrap="nowrap" >
		  		<?php echo $this->lists['spolka'];?>
		  	</td>
		  	<td colspan="2" nowrap="nowrap" >
		  		<?php echo $this->lists['obiekt'];?>
		  	</td>
		  	<td nowrap="nowrap">
		 		<?php echo $this->lists['del'];?>
		  	</td>
		 </tr>
	</table>

	<table class="adminlist" cellpadding="1">
		<thead>
			<tr>
				<th width="2%" class="title">
					<?php echo 'Lp'; ?>
				</th>
				<th width="3%" class="title">
					<input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count($this->items); ?>);" />
				</th>
				<th class="title">
					<?php echo JHTML::_('grid.sort',   'Typ', 'a.typ', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
				</th>
				<th class="title">
					<?php echo JHTML::_('grid.sort',   'Nazwa', 'a.mo1', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
				</th>
				<th class="title">
					<?php echo JHTML::_('grid.sort',   'Model', 'a.mo2', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
				</th>
				<th class="title">
					<?php echo JHTML::_('grid.sort',   'Rok prod.', 'a.mo3', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
				</th>
				<th class="title">
					<?php echo JHTML::_('grid.sort',   'Nr seryjny', 'a.mo4', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
				</th>
				<th class="title">
					<?php echo JHTML::_('grid.sort',   'Nr inwentarzowy', 'a.nri', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
				</th>
				<th class="title">
					<?php echo JHTML::_('grid.sort',   'Dotacja', 'f.dotacja', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
				</th>
				<th class="title">
					<?php echo JHTML::_('grid.sort',   'Wartość', 'b.wartosc', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
				</th>
				<th class="title">
					<?php echo JHTML::_('grid.sort',   'Typ własności', 'c.msw1', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
				</th>
				<th class="title">
					<?php echo JHTML::_('grid.sort',   'Właściciel', 'c.msw6', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
				</th>
				<th class="title">
					<?php echo JHTML::_('grid.sort',   'Spółka użytkująca', 'd.spolka', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
				</th>
				<th class="title">
					<?php echo JHTML::_('grid.sort',   'Obiekt', 'e.obiekt', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
				</th>
			</tr>
		</thead>
		<tfoot>
			<tr>
				<td colspan="14">
					<?php echo $this->pagination->getListFooter(); ?>
				</td>
			</tr>
		</tfoot>
		<tbody>
		<?php
			$k = 0;
			for ($i=0, $n=count( $this->items ); $i < $n; $i++)
			{
				$row 	=& $this->items[$i];
				// Link wskazuje na grupę rekordów dla danego pojazdu
				$link 	= 'index.php?option=com_maszyny_user&amp;view=maszyna_user&amp;task=edit&amp;gid='. $row->gid. '';

			?>
			<tr class="<?php echo "row$k"; ?>">
				<td>
					<?php echo $i+1+$this->pagination->limitstart;?>
				</td>
				<td>
					<!-- Wysyłamy numer grupy dla usunięcie pojazdu --> 
					<?php echo JHTML::_('grid.id', $i, $row->gid ); ?>
				</td>
				<td>
					<?php echo $row->typ; ?>
				</td>
				<td>
					<a href="<?php echo $link; ?>"><?php echo $row->mo1; ?></a>
				</td>
				<td>
					<?php echo $row->mo2; ?>
				</td>
				<td>
					<?php echo $row->mo3; ?>
				</td>
				<td>
					<?php echo $row->mo4; ?>
				</td>
				<td>
					<?php echo $row->nri; ?>
				</td>
				<td>
					<?php echo $row->dotacja; ?>
				</td>
				<td>
					<?php echo $row->wartosc; ?>
				</td>
				<td>
					<?php echo $row->msw1; ?>
				</td>
				<td>
					<?php echo $row->msw6; ?>
				</td>
				<td>
					<?php echo $row->spolka; ?>
				</td>
				<td>
					<?php echo $row->obiekt; ?>
				</td>
			</tr>
			<?php
				$k = 1 - $k;
				}
			?>
		</tbody>
	</table>

	<input type="hidden" name="option" value="com_maszyny_user" />
	<input type="hidden" name="task" value="" />
	<input type="hidden" name="boxchecked" value="0" />
	<input type="hidden" name="filter_order" value="<?php echo $this->lists['order']; ?>" />
	<input type="hidden" name="filter_order_Dir" value="<?php echo $this->lists['order_Dir']; ?>" />
	<?php echo JHTML::_( 'form.token' ); ?>
</form>